package br.unirio.leilao.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.ApplicationAware;

import br.unirio.leilao.dao.AlbumDAO;
import br.unirio.leilao.dao.EstiloDAO;
import br.unirio.leilao.entity.Estilo;

import com.opensymphony.xwork2.ActionSupport;


public class OlaMundoAction extends ActionSupport implements ApplicationAware{
	
	private static final long serialVersionUID = 2782958285496443732L;
	private Map<String, Object> application;
	AlbumDAO albumDAO;	
	EstiloDAO estiloDAO;
	private List<Estilo> estilosNivel0;
	
	public String execute() {
		albumDAO = AlbumDAO.getInstance();
		estiloDAO = EstiloDAO.getInstance();
		application.put("discs", albumDAO.getLista());
		this.estilosNivel0 = estiloDAO.getListaEstilosNivel0();
		application.put("estilosNivel0", estilosNivel0);
		application.put("estilosNivel1", estiloDAO.getListaEstilosNivel1());
		System.out.println("Executando a l�gica com Struts2");
		return "ok";
	}

	public void setEstilosNivel0(List<Estilo> estilosNivel0) {
		this.estilosNivel0 = estilosNivel0;
	}
	public List<Estilo> estilosNivel0() {
		return estilosNivel0;
	}
	@Override
	public void setApplication(Map<String, Object> application) {
		this.application = application;
		
	}
}

